package com.nidu.demo.user.dto;

import com.nidu.demo.base.BaseCmd;
import com.nidu.demo.common.enums.GenderEnum;
import com.nidu.demo.common.validation.InEnum;
import com.nidu.demo.common.validation.Mobile;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.Set;

/**
 * 用户添加命令
 *
 * @author auto
 */
@Data
@Schema(description = "用户添加命令")
@EqualsAndHashCode(callSuper = true)
public class UserAddCmd extends BaseCmd {

    /**
     * 用户名
     */
    @NotBlank(message = "用户名不能为空")
    @Pattern(regexp = "^[A-Za-z0-9_]{4,32}$", message = "用户名只能包含字母、数字和下划线，长度在4-32之间")
    @Schema(description = "用户名", example = "admin")
    private String username;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空")
    @Size(min = 6, max = 64, message = "密码长度必须在6-64个字符之间")
    @Schema(description = "密码", example = "123456")
    private String password;

    /**
     * 昵称
     */
    @Size(max = 64, message = "昵称长度不能超过64个字符")
    @Schema(description = "昵称", example = "管理员")
    private String nickname;

    /**
     * 手机号
     */
    @NotBlank(message = "手机号不能为空")
    @Mobile
    @Schema(description = "手机号", example = "13800138000")
    private String mobile;

    /**
     * 邮箱
     */
    @Email(message = "邮箱格式不正确")
    @Size(max = 128, message = "邮箱长度不能超过128个字符")
    @Schema(description = "邮箱", example = "admin@example.com")
    private String email;

    /**
     * 头像
     */
    @Size(max = 255, message = "头像URL长度不能超过255个字符")
    @Schema(description = "头像")
    private String avatar;

    /**
     * 性别
     */
    @Schema(description = "性别(1:男,2:女)", example = "1")
    @InEnum(GenderEnum.class)
    private Integer gender;


    /**
     * 公司ID列表
     */
    @Schema(description = "公司ID", example = "1")
    private Long companyId;

    /**
     * 描述
     */
    @Size(max = 255, message = "描述长度不能超过255个字符")
    @Schema(description = "描述", example = "系统管理员")
    private String remark;

    /**
     * 部门ID列表
     */
    @Schema(description = "部门ID列表")
    private Set<Long> deptIds;

    /**
     * 职位ID列表
     */
    @Schema(description = "职位ID列表")
    private Set<Long> postIds;

} 